import request from '@/config/axios'

export interface CodeVO {
  id: number
  defineCode: string
  mainCode: string
  notes: string
}

// 查询代码列表
export const getCodePage = async (params) => {
  return await request.get({ url: `/sca/code/page`, params })
}

// 查询代码详情
export const getCode = async (id: number) => {
  return await request.get({ url: `/sca/code/get?id=` + id })
}

// 新增代码
export const createCode = async (data: CodeVO) => {
  return await request.post({ url: `/sca/code/create`, data })
}

// 修改代码
export const updateCode = async (data: CodeVO) => {
  return await request.put({ url: `/sca/code/update`, data })
}

// 删除代码
export const deleteCode = async (id: number) => {
  return await request.delete({ url: `/sca/code/delete?id=` + id })
}

// 导出代码 Excel
export const exportCode = async (params) => {
  return await request.download({ url: `/sca/code/export-excel`, params })
}
